export function getBrowserInfo () {
    const agent = navigator.userAgent.toLowerCase();
    const arr = []
    const system = agent.split(' ')[1].split(' ')[0].split('(')[1];
    arr.push(system);
    const regStrEdge = /edge\/[\d.]+/gi;
    const regStrIe = /trident\/[\d.]+/gi;
    const regStrFf = /firefox\/[\d.]+/gi;
    const regStrChrome = /chrome\/[\d.]+/gi;
    const regStrSaf = /safari\/[\d.]+/gi;
    const regStrOpera = /opr\/[\d.]+/gi;

    if (agent.indexOf("trident") > 0) {
        arr.push(agent.match(regStrIe)[0].split('/')[0]);
        arr.push(agent.match(regStrIe)[0].split('/')[1]);
        return arr;
    }

    if (agent.indexOf('edge') > 0) {
        arr.push(agent.match(regStrEdge)[0].split('/')[0]);
        arr.push(agent.match(regStrEdge)[0].split('/')[1]);
        return arr;
    }

    if (agent.indexOf("firefox") > 0) {
        arr.push(agent.match(regStrFf)[0].split('/')[0]);
        arr.push(agent.match(regStrFf)[0].split('/')[1]);
        return arr;
    }

    if (agent.indexOf("opr") > 0) {
        arr.push(agent.match(regStrOpera)[0].split('/')[0]);
        arr.push(agent.match(regStrOpera)[0].split('/')[1]);
        return arr;
    }

    if (agent.indexOf("safari") > 0 && agent.indexOf("chrome") < 0) {
        arr.push(agent.match(regStrSaf)[0].split('/')[0]);
        arr.push(agent.match(regStrSaf)[0].split('/')[1]);
        return arr;
    }

    if (agent.indexOf("chrome") > 0) {
        arr.push(agent.match(regStrChrome)[0].split('/')[0]);
        arr.push(agent.match(regStrChrome)[0].split('/')[1]);
        return arr;
    }

    return arr
}
